import java.util.Scanner;

public class HomeWorkDemo06 {

    public static void main(String[] args) {
        String card = "345678";
        String password = "123456";
        float balance = 100.1f;


        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入银行账户");
        String iCard = scanner.next();
        if (card.equals(iCard)) {// 判断账号

            for (int i = 0; i < 3; i++) {
                System.out.println("请输入密码");
                String iPassWord = scanner.next();// 输入密码
                if (password.equals(iPassWord)) {// 判断密码
                    System.out.println("请输入取款金额");
                    float money = scanner.nextFloat();// 输入取款金额
                    if (money > 0) {
                        if (balance >= money) {
//                    System.out.println("取款金额为" + money + "元，剩余" + (balance - money) + "元");
                            System.out.println("取款金额为" + money + "元，剩余" + String.format("%.2f", (balance - money)) + "元");
                        } else {
                            System.out.println("余额不足");
                        }
                    } else {
                        System.out.println("取款金额只能是正整数");
                    }
                    break;// 停止循环


                } else {
                    if (i == 2) {
                        System.out.println("冻结银行卡");
                    } else {
                        System.out.println("密码错误");
                    }

                }
            }

        } else {
            System.out.println("账户错误");
        }


    }


}
